package cn.ad.server.persistence.dao;

import java.util.List;

import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.mapping.FetchType;
import org.springframework.stereotype.Component;

import cn.ad.server.domain.ad.PlatformTagSizeMap;

@Component
public interface PlatformTagSizeMapDao {
	
	@Results(value = { 
			@Result(column = "id", property = "id", id=true),
			@Result(column = "platform_id", property = "platformId"),
			@Result(column = "tag_id", property = "tagId"),
			@Result(column = "ad_format", property = "adFormat"),
			@Result(column = "size_id", property = "sizeId"),
			@Result(column = "size_id", property = "adSize",one=@One(select="cn.ad.server.persistence.dao.AdSizeDao.findValidById",fetchType = FetchType.DEFAULT)),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from platform_tag_size_map")
	public List<PlatformTagSizeMap> findAll();
	
	@Results(value = { 
			@Result(column = "id", property = "id", id=true),
			@Result(column = "platform_id", property = "platformId"),
			@Result(column = "tag_id", property = "tagId"),
			@Result(column = "ad_format", property = "adFormat"),
			@Result(column = "size_id", property = "sizeId"),
			@Result(column = "size_id", property = "adSize",one=@One(select="cn.ad.server.persistence.dao.AdSizeDao.findValidById",fetchType = FetchType.DEFAULT)),
			@Result(column = "create_time", property = "createTime"),
			@Result(column = "update_time", property = "updateTime") })
	@Select("select * from platform_tag_size_map where update_time >= #{value}")
	public List<PlatformTagSizeMap> findAfterTime(String warmUpTime);

}
